/**
* Description here...
* @author Default
* @version 0.1
*/

package engine.materials
{
	
	import engine.materials.Material;
	import engine.geom.Face;
	import engine.geom.Vector;
	import engine.utils.Raster;
	import engine.math.VectorUtils;
	import flash.display.Sprite;
	import flash.display.Graphics;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	
	public class RasterWireframe extends Material
	{

		public var wireColor:Number = 0xFFFFFFFF;
		private var bmp:Bitmap;
		
		public function RasterColor ( screen:Sprite )
		{
			super( null );
			bmp = new Bitmap ( new BitmapData ( screen.width,screen.height, true, 0x00 ) );
			screen.addChild( bmp );
		}
		
		public override function render ( face:Face, screen:Sprite ) : void
		{
			// get vertices x,y positions
			var v0:Object = face.vertices[0];
			var v1:Object = face.vertices[1];
			var v2:Object = face.vertices[2];
	
			var x0:Number = v0.screen.x;
			var y0:Number = v0.screen.y;
			var x1:Number = v1.screen.x;
			var y1:Number = v1.screen.y;
			var x2:Number = v2.screen.x;
			var y2:Number = v2.screen.y;
			
			// Draw triangle
			Raster.triangle ( bmp.bitmapData, x0,y0,x1,y1,x2,y2, wireColor );
			
		}
		
	}
	
}
